#pragma once

#include "base.h"
#include "allocation.h"
#include "objects.h"
#include "handles.h"

namespace cgen {
namespace internal {

class ZoneScopeInfo;

class Heap : public AllStatic
{
public:
    // Makes a new native code object
    // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
    // failed. On success, the pointer to the Code object is stored in the
    // self_reference. This allows generated code to reference its own Code
    // object by containing this pointer.
    // Please note this function does not perform a garbage collection.
    static Object* CreateCode(
            const CodeDesc& desc,
            ZoneScopeInfo* sinfo,
            Code::Flags flags,
            Handle<Object> self_reference);

    static bool HasBeenSetup();

    static int OldGenerationSize();

    static bool InNewSpace(Object * o);

private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(Heap);
};

}} // namespace cgen::internal
